<ion-header>
    <ion-navbar core-back-button>
        <ion-title>{{ 'addon.mod_workshop.editsubmission' | translate }}</ion-title>
        <ion-buttons end>
            <button ion-button clear (click)="save()" [attr.aria-label]="'core.save' | translate">
                {{ 'core.save' | translate }}
            </button>
        </ion-buttons>
    </ion-navbar>
</ion-header>
<ion-content>
    <core-loading [hideUntil]="loaded">
        <form ion-list [formGroup]="editForm" *ngIf="workshop">
            <ion-item text-wrap>
                <ion-label stacked core-mark-required="true">{{ 'addon.mod_workshop.submissiontitle' | translate }}</ion-label>
                <ion-input name="title" type="text" [placeholder]="'addon.mod_workshop.submissiontitle' | translate" formControlName="title"></ion-input>
            </ion-item>

            <ion-item *ngIf="textAvailable">
                <ion-label stacked [core-mark-required]="textRequired">{{ 'addon.mod_workshop.submissioncontent' | translate }}</ion-label>
                <core-rich-text-editor item-content [control]="editForm.controls['content']" formControlName="content" [placeholder]="'addon.mod_workshop.submissioncontent' | translate"  name="content" [component]="component" [componentId]="componentId"></core-rich-text-editor>
            </ion-item>

            <core-attachments *ngIf="fileAvailable" [files]="submission.attachmentfiles" [maxSize]="workshop.maxbytes" [maxSubmissions]="workshop.nattachments" [component]="component" [componentId]="workshop.coursemodule" allowOffline="true" [acceptedTypes]="workshop.submissionfiletypes" [required]="fileRequired"></core-attachments>
        </form>
    </core-loading>
</ion-content>
